bitkeeper revision 1.736.1.1 (403a080497wPGih2o-t3yWbCwW8kKw)
authorsmh22@tempest.cl.cam.ac.uk <smh22@tempest.cl.cam.ac.uk>
Mon, 23 Feb 2004 14:02:44 +0000 (14:02 +0000)
committersmh22@tempest.cl.cam.ac.uk <smh22@tempest.cl.cam.ac.uk>
Mon, 23 Feb 2004 14:02:44 +0000 (14:02 +0000)
fix xen support for cciss

xen/common/domain.c
xen/drivers/block/cciss.c
xen/drivers/block/xen_block.c

index 4f45a88b914c00ad4a25f629707e8b6cea79ec7d..41ca90c1b73e3a74129967d98b56e1652dfba39e 100644 (file)
@@ -570,6 +570,7 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
 
     extern void ide_probe_devices(xen_disk_info_t *);
     extern void scsi_probe_devices(xen_disk_info_t *);
+    extern void cciss_probe_devices(xen_disk_info_t *);
     xen_disk_info_t xdi;
     xen_disk_t *xd;
 
@@ -803,6 +804,7 @@ int setup_guestos(struct task_struct *p, dom0_createdomain_t *params,
     xdi.disks = xd;
     ide_probe_devices(&xdi);
     scsi_probe_devices(&xdi);
+    cciss_probe_devices(&xdi);
     for ( i = 0; i < xdi.count; i++ )
     {
         xen_extent_t e;
index 0c49aae5d05dac2c3680eeb836226f9ee5a5e903..6e7096c890974500d22ee1e257fb441cb7696e4b 100644 (file)
@@ -433,6 +433,44 @@ static void cciss_geninit( int ctlr)
        }
        hba[ctlr]->gendisk.nr_real = hba[ctlr]->highest_lun+1;
 }
+
+
+void cciss_probe_devices(xen_disk_info_t *xdi)
+{
+    int i, ctlr;
+    drive_info_struct *drv; 
+    xen_disk_t *xd = &xdi->disks[xdi->count];
+
+    ctlr = 0;  /* XXX SMH: only deal with 1 controller for now */
+
+    /* Loop through each real device */ 
+    for(i=0; i < NWD; i++) {
+       
+        drv = &(hba[ctlr]->drv[i]);
+       
+       if (!(drv->nr_blocks))
+            continue;
+       
+       if ( xdi->count == xdi->max )
+           BUG();
+       
+       
+       hba[ctlr]->hd[i << NWD_SHIFT].nr_sects = 
+           hba[ctlr]->sizes[i << NWD_SHIFT] = drv->nr_blocks;
+       
+       /* We export 'raw' linux device numbers to domain 0. */
+       xd->device   = MKDEV(hba[ctlr]->major, i << 4); 
+       xd->info     = XD_TYPE_DISK;   /* XXX should check properly   */
+        xd->capacity = drv->nr_blocks; /* in terms of 512byte sectors */
+       xd->domain   = 0;
+       
+       xdi->count++;
+        xd++;
+       
+    }
+
+}
+
 /*
  * Open.  Make sure the device is really there.
  */
@@ -2394,8 +2432,8 @@ next:
        seg = 0;
        lastdataend = ~0ULL;
        while(bh) {
-//             if (bh_phys(bh) == lastdataend)
-               if ((page_to_phys(bh->b_page) + bh_offset(bh))== lastdataend)
+
+               if (bh_phys(bh) == lastdataend)
                {  /* tack it on to the last segment */
                        tmp_sg[seg-1].length +=bh->b_size;
                        lastdataend += bh->b_size;
index 937086a6a048f96196041c33e6f7f82fb0505363..eaf901a328d155c3327c5db5f2403125547fc1e3 100644 (file)
@@ -499,7 +499,13 @@ static void dispatch_rw_block_io(struct task_struct *p,
         bh->b_size          = phys_seg[i].nr_sects << 9;
         bh->b_dev           = phys_seg[i].dev;
         bh->b_rsector       = (unsigned long)phys_seg[i].sector_number;
+
+       /* SMH: we store a 'pseudo-virtual' bogus address in b_data since
+          later code will undo this transformation (i.e. +-PAGE_OFFSET). */
         bh->b_data          = phys_to_virt(phys_seg[i].buffer);
+       
+       /* SMH: bh_phys() uses the below field as a 'cheap' virt_to_phys */
+       bh->b_page          = &frame_table[phys_seg[i].buffer>>PAGE_SHIFT]; 
         bh->b_end_io        = end_block_io_op;
         bh->pending_req     = pending_req;